package edu.sctu.jsoup.service;

import edu.sctu.jsoup.entity.StudentEntity;
import edu.sctu.jsoup.repo.StudentRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2017-10-9.
 */
@Service
public class StudentService {

    @Autowired
    private StudentRepo studentRepo;

    public void run(){


        studentRepo.findOne(10L);

        List<StudentEntity> studentEntities = studentRepo.findByName("chen");

        for (StudentEntity entity : studentEntities){
            System.out.println(entity.getId());
            System.out.println(entity.getName());
            System.out.println(entity.getAge());
        }

//
//
//        StudentEntity chen = new StudentEntity();
//        chen.setName("chen");
//        chen.setAge(30);
//
//
//        studentRepo.save(chen);

    }


}
